#include <iostream>
using namespace std;
class Boat;
class Car
{
public:
	Car(int j)
	{
		weight = j;
	}
	friend int totalWeight(Car &aCar, Boat &aBoat);
private:
	int weight;
};
class Boat
{
public:
	Boat(int j)
	{
		weight = j;
	}
	friend int totalWeight(Car &aCar, Boat &aBoat);
private:
	int weight;
};
int totalWeight(Car &aCar, Boat &aBoat)
{
	return aCar.weight + aBoat.weight;
}

int main()
{
	Car c(4);
	Boat b(5);
	cout << totalWeight(c,b)<<endl;
	return 0;
}
